{% extends "xadmin/edit_inline/base.html" %}
{% load i18n xadmin_tags crispy_forms_tags %}

{% block formset_form %}
  <div class="accordion-group formset-row">
    <div class="accordion-heading">
      {% if formset.formset.can_delete %}
        <a class="delete-row pull-right"><i class="icon icon-remove"></i></a>
      {% endif %}
      <a class="accordion-toggle" data-toggle="collapse" data-parent="#{{ formset.css_id }}-accordion" href="#{{ prefix }}-{{ forloop.counter0 }}-body"><b>{{ formset.opts.verbose_name|title }}:</b>&nbsp;{% if fs.instance.pk %}{{ fs.instance }}{% else %}#<span class="formset-num">{{ forloop.counter }}</span>{% endif %}
      </a>
    </div>
    <div class="accordion-body collapse" id="{{ prefix }}-{{ forloop.counter0 }}-body">
      <div class="accordion-inner">
      {% crispy fs formset.formset.helper %}
      </div>
    </div>
  </div>
{% endblock formset_form %}
{% block formset_empty %}
  <div class="accordion-group formset-row">
    <div class="accordion-heading">
      {% if formset.formset.can_delete %}
          <a class="delete-row pull-right"><i class="icon icon-remove"></i></a>
      {% endif %}
      <a class="accordion-toggle" data-toggle="collapse" data-parent="#{{ formset.css_id }}-accordion" href="#{{ prefix }}-__prefix__-body">
        <b>{{ formset.opts.verbose_name|title }}:</b>&nbsp;{% if fs.instance.pk %}{{ fs.instance }}{% else %}#<span class="formset-num">{{ forloop.counter }}</span>{% endif %}
      </a>
    </div>
    <div class="accordion-body collapse" id="{{ prefix }}-__prefix__-body">
      <div class="accordion-inner">
      {% crispy formset.formset.empty_form formset.formset.helper %}
      </div>
    </div>
  </div>
{% endblock formset_empty %}